﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace DataTokensDemo.Controllers
{
    [HandleError]
    public class HomeController : Controller
    {
        public ActionResult Index()
        {
            ViewData["Message"] = "Welcome to ASP.NET MVC!";

            return View();
        }

        public ActionResult IndexParam(string database, int year, int month, int day)
        {

            string connString = string.Empty;
            switch (database)
            {
                case "sport":
                    connString = "sportConnString";
                    break;
                case "technology":
                    connString = "techConnString";
                    break;
            }
            ViewData["Message"] = String.Format("Connecting to database {0}", connString);

            return View("Index");
        }

        public ActionResult IndexDT(int year, int month, int day)
        {
            ViewData["Message"] = String.Format("Connecting to database {0}",
                RouteData.DataTokens["database"]);

            return View("Index");
        }

        public ActionResult About()
        {
            return View();
        }
    }
}
